<template>
  <div class="commentPop">
    <van-popup v-model="reComShow" position="bottom">
      <div class="commentBox">
        <div class="boxTop">
          <van-field
            v-model="recommentMsg"
            rows="4"
            type="textarea"
            :placeholder="`回复: ${itemObj.aut_name}:${itemObj.content}`"
          />
        </div>
        <div class="boxBot">
          快打起来~
          <van-button
            type="info"
            class="send"
            @click="recommentClick(itemObj.com_id)"
            >发送</van-button
          >
        </div>
      </div>
    </van-popup>
  </div>
</template>

<script>
import { apiAddCommentReply } from '../../api/comment'
export default {
  name: 'commentPop',
  data () {
    return {
      reComShow: false,
      recommentMsg: '',
      itemObj: ''
    }
  },
  methods: {
    async recommentClick (id) {
      console.log('回复评论', id)
      const res9 = await apiAddCommentReply({
        commid: id,
        content: this.recommentMsg,
        artid: this.detailId
      })
      console.log(res9)
      this.$toast.success('评论成功')
      this.recommentMsg = ''
      this.reComShow = false
      this.$emit('refreshComData')
    }

  }
}
</script>

<style lang="less" scoped>
.commentPop {
  // 评论弹窗样式
  .commentBox {
    padding: 10px;
    .boxTop {
      border: 1px solid #ccc;
    }
    .boxBot {
      font-size: 16px;
      line-height: 28px;
      text-indent: 10px;
      margin-top: 5px;
      .send {
        width: 80px;
        height: 28px;
        float: right;
      }
    }
  }
}
</style>
